<?php
/****** BOOTSTRAP *******/

/**
 * Define paths
 */
define('BASE_PATH', realpath(dirname(__FILE__) . '/..'));
define('APPLICATION_PATH', BASE_PATH . '/app');
define('DOMAIN', 'http://' . $_SERVER['HTTP_HOST'] . '/rentsearch/');

/**
 * Timezone
 */
date_default_timezone_set('Europe/Kiev');

/**
 * Enable error reporting
 */
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);

/**
 * Load debug functions
 */
require_once 'func.php';

/**
 * Set include path
 */
set_include_path(
    APPLICATION_PATH . PATH_SEPARATOR .
    BASE_PATH . '/libs' . PATH_SEPARATOR
);

/**
 * Autoload
 *
 * @param string $class
 * @return void
 */
function __autoload($class)
{
    $path = str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';
    require_once $path;
}

/**
 * Load Simple HTML Dom
 *
 * @link http://simplehtmldom.sourceforge.net/index.htm
 */
require_once 'libs/simplehtmldom/simple_html_dom.php';

/****************** DB connect ******************/

/* Configures PDO to execute the 'SET NAMES UTF8;' SQL query just before
   any other query. If no query is executed on your page, this will not be
   executed. */
$pdoParams = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8;');

$params = array(
    'host' => 'localhost',
    'username' => 'root',
    'password' => 'FSLLBOCEzdeLYcLzjLSv',
    'dbname' => 'renter',
    'driver_options' => $pdoParams
);

try {
    $db = Zend_Db::factory('PDO_MYSQL', $params);
    Zend_Db_Table_Abstract::setDefaultAdapter($db);
} catch (Exception $e) {
    exit($e->getMessage());
}
unset($params);
unset($pdoParams);
unset($db);

//Zend_Registry::set('dbAdapter', $db);

/****************** EOF DB connect ******************/

